{% extends "subpage/base.html" %}

{% block style %}
    {{ super() }}
{% endblock style %}

{% block title %}
    运维日报 | Auth
{% endblock title %}

{% block title_text %}
    <h3 class="account-title">
        <span>账户详情</span>
        <small>{{ user.lastchange.strftime("%Y-%m-%d %H:%M:%S")|default('',True) }}</small>
        <button type="button" class="btn btn-primary pull-right"
                onclick="javascript:location.href='{{ url_for('blue_duty.index') }}'">返回
        </button>
    </h3>
{% endblock title_text %}

{% block table %}
    <!-- .row1 -->
    <div class="row">
        <!-- .col -->
        <div class="col-xs-offset-2 col-xs-8">
            <div class="account-info-box box">
                <div class="account-box-header">
                </div>
                <div class="account-box-body">
                    <form class="form-horizontal" role="form" method="post" enctype="multipart/form-data"
                          action="{{ url_for('blue_auth.user_info', id=user.id, _external=True) }}">
                        {{ user_info_form.hidden_tag() }}
                        <div class="form-group">
                            <label for="" class="control-label col-xs-2">账户</label>
                            <div class="input-group col-xs-8">
                            <span class="input-group-addon">
                                <i class="fa fa-user"></i>
                            </span>
                                {{ user_info_form.user_name(class='form-control pull-right', value=user.name, disabled=True) }}
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="" class="control-label col-xs-2">描述</label>
                            <div class="input-group col-xs-8">
                                <span class="input-group-addon">
                                    <i class="fa fa-tag"></i>
                                </span>
                                {{ user_info_form.user_alias(class="form-control pull-right",value=user.alias|default('',True) ) }}
                            </div>
                        </div>
                        <div class="form-group {% if user_info_form.user_email.errors %}has-error{% endif %}">
                            <label for="" class="control-label col-xs-2">邮箱</label>
                            <div class="input-group col-xs-8">
                                <div class="input-group-addon">
                                    <i class="fa fa-envelope"></i>
                                </div>
                                {{ user_info_form.user_email(class="form-control pull-right", value=user.email|default('',True)) }}
                            </div>
                            {% for e in user_info_form.user_email.errors %}
                                <p class="help-block2 col-xs-offset-2">{{ e }}</p>
                            {% endfor %}
                        </div>
                        <div class="form-group">
                            <div class="col-xs-8 col-xs-offset-2 padding-none">
                                <div class="col-xs-6 input-group pull-left">
                                    <span class="input-group-addon">
                                          {% if user.status %}
                                              {{ user_info_form.user_isactive(class='flat-green',checked=True) }}
                                          {% else %}
                                              {{ user_info_form.user_isactive(class='flat-green') }}
                                          {% endif %}
                                    </span>
                                    <input type="text" value="是否激活" disabled="disabled" class="form-control"/>
                                </div>
                            </div>
                        </div>
                        <hr>
                        <!-- <h4>修改密码</h4> -->
                        <div class="form-group">
                            <div class="col-xs-8 col-xs-offset-2 padding-none">
                                <div class="col-xs-6 input-group">
                                    <span class="input-group-addon">
                                        {{ user_info_form.pwd_is_changed(class="flat-red") }}
                                    </span>
                                    <input type="text" value="是否修改密码" disabled="disabled" class="form-control"/>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="" class="control-label col-xs-2">当前密码</label>
                            <div class="input-group col-xs-8">
                                <div class="input-group-addon">
                                    <i class="fa fa-unlock"></i>
                                </div>
                                {{ user_info_form.old_pwd(class="form-control",placeholder="输入当前密码") }}
                            </div>
                            {% for e in user_info_form.old_pwd.errors %}
                                <p class="help-block2 col-xs-offset-2">{{ e }}</p>
                            {% endfor %}

                        </div>
                        <div class="form-group">
                            <label for="" class="control-label col-xs-2">新密码</label>
                            <div class="input-group col-xs-8">
                                <div class="input-group-addon">
                                    <i class="fa fa-lock"></i>
                                </div>
                                {{ user_info_form.new_pwd01(class="form-control", placeholder="输入新密码") }}
                            </div>
                            {% for e in user_info_form.new_pwd01.errors %}
                                <p class="help-block2 col-xs-offset-2 ">{{ e }}</p>
                            {% endfor %}
                        </div>
                        <div class="form-group">
                            <label for="" class="control-label col-xs-2">重新输入</label>
                            <div class="input-group col-xs-8">
                                <div class="input-group-addon">
                                    <i class="fa fa-lock"></i>
                                </div>
                                {{ user_info_form.new_pwd02(class="form-control",placeholder="再次确认新密码") }}
                            </div>
                            {% for e in user_info_form.new_pwd02.errors %}
                                <p class="help-block2 col-xs-offset-2">{{ e }}</p>
                            {% endfor %}
                        </div>
                </div>
                <div class="account-box-footer">
                    <div class="form-group">
                        <div class="pull-left">
                            <button type="button" class="btn btn-default pull-left"
                                    onclick="javascript:location.href='{{ url_for('blue_auth.user_info', id=user.id) }}'">
                                重置
                            </button>
                        </div>
                        <div class="pull-right">
                            {{ user_info_form.btn_submit(class="btn btn-danger pull-right") }}
                        </div>
                    </div>
                </div>
                </form>
            </div>
        </div>
        <!-- / .col -->
    </div>
    <!-- / .row1 -->
{% endblock table %}

{% block content %}
    {{ super() }}
    <script>
        $(function () {
            //弥补一些css缺陷
            $(".account-title").parents(".title-box").css({
                "border-bottom": "1px solid #ccc"
            });
        });
    </script>
{% endblock %}